/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 17655
 * Date: 2025-03-23
 * Time: 14:43
 */
public class test3 {
    public int maxArea(int[] height) {
        int left = 0;
        int n = height.length;
        int right = n-1;
        int ret = Integer.MIN_VALUE;
        while(left<right){
            int max = (right-left) * (Math.min(height[left],height[right]));
            ret = Math.max(ret,max);
            if(height[left]>height[right]){
                right--;
            }else{
                left++;
            }
        }
        return ret;
    }
}
